/*
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2025-08-06 15:06:41
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2025-08-06 15:10:06
 * @FilePath: \project\work-tool\my-dev-project\src\utils\storage.ts
 * @Description: 
 */

export default {
    /**
     * 将指定的键值对存储到localStorage中
     * @param key 要存储的键名
     * @param value 要存储的值，可以是任意类型，会被序列化为JSON字符串存储
     */
    set(key: string, value: unknown) {
        localStorage.setItem(key, JSON.stringify(value));
    },
    get(key: string) {
        return JSON.parse(localStorage.getItem(key) as string);
    },
    remove(key: string) {
        localStorage.removeItem(key);
    },
    clear() {
        localStorage.clear();
    }
}